<?php
require_once 'header.php';


?>
<!DOCTYPE html>
<html lang="en">
<head>

    <!-- start: Meta -->
    <meta charset="utf-8">
    <title>
        <?php echo $A_CONFIG['backstage_name']; ?>
    </title>
    <meta name="description" content="Bootstrap Metro Dashboard">
    <!-- end: Meta -->

    <!-- start: Mobile Specific -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- end: Mobile Specific -->

    <!-- start: CSS -->
    <link id="bootstrap-style" href="css/bootstrap.min.css" rel="stylesheet">
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <!--    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">-->
    <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
    <link id="base-style" href="css/style.css" rel="stylesheet">
    <link id="base-style-responsive" href="css/style-responsive.css" rel="stylesheet">
    <!--    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,cyrillic-ext,latin-ext'-->
    <!--          rel='stylesheet' type='text/css'>-->
    <link href="css/myAdmin.css" rel="stylesheet">

    <!-- end: CSS -->


    <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <link id="ie-style" href="css/ie.css" rel="stylesheet">
    <![endif]-->

    <!--[if IE 9]>
    <link id="ie9style" href="css/ie9.css" rel="stylesheet">
    <![endif]-->


</head>

<body>

<?php
include "header_menu.php";
?>

<div class="container-fluid-full">
    <div class="row-fluid">
        <?php
        include "side_nav_bar.php";
        ?>


        <!-- start: Content -->
        <div id="wrap">

            <div id="content" class="span10">
                <!-- start: 功能按钮模块-->
                <div style="min-height:20px">
                    <ul class="breadcrumb myBtnUl">
                        <li @click="popDownloadUser()"  style="visibility:hidden;">
                            <button class="btn btn-primary">人员信息导出</button>
                        </li>

                        <li style="float: left;">
                            <div class="input-append" style="border: 1px #578ebe solid;margin-bottom: 20px;">
                                <select style="height: 35px" id="user_status" @change="select_status()">
                                    <option>全部</option>
                                    <option>空闲</option>
                                    <option>租借中</option>
                                    <option>待支付</option>
                                    <option>丢失</option>
                                    <option>损坏</option>
                                </select>
                            </div>
                        </li>
<!--                        <li @click="popUploadUser()"  style="display: none;">-->
<!--                            <button class="btn btn-primary">人员信息导入</button>-->
<!--                        </li>-->
<!--                        <li @click="popAddUser()" >-->
<!--                            <button class="btn btn-primary">链接添加</button>-->
<!--                        </li>-->
                        <li style="float: right;">
                            <div class="input-append" style="border: 1px #578ebe solid;margin-bottom: 0;">
                                <input style="height: 24px" id="search-text" size="16" type="text">
                                <button @click="search()" class="btn btn-primary" type="button">搜索</button>
                            </div>
                        </li>
                    </ul>

<!--                    <ul class="breadcrumb myBtnUl" style="width:110%;min-height:53px">-->
<!--                        <li style="float: left;">-->
<!--                            <div class="input-append" style="border: 1px #578ebe solid;margin-bottom: 20px;">-->
<!--                                <select style="height: 35px" id="floor" @change="select_floor()">-->
<!--                                    <option>全部</option>-->
<!--                                    <option v-for="item1 in flooritem " :value="item1.info.floor_name">-->
<!--                                        {{item1.info.floor_name}}-->
<!--                                    </option>-->
<!--                                </select>-->
<!--                            </div>-->
<!--                        </li>-->
<!--                        <li style="float: left;">-->
<!--                            <div class="input-append" style="border: 1px #578ebe solid;margin-bottom: 20px;">-->
<!--                                <select style="height: 35px" id="roomName" @change="select_room()">-->
<!--                                    <option>全部</option>-->
<!--                                    <option v-for="item2 in roomitem" :value="item2.info.room_name">-->
<!--                                        {{item2.info.room_name}}-->
<!--                                    </option>-->
<!--                                </select>-->
<!--                            </div>-->
<!--                        </li>-->
<!--                    </ul>-->
                    <!-- end: 功能按钮模块-->
                    <!-- start: 列表 -->
                </div>

                <div class="table-responsive">
                    <table class="table table-bordered table-striped bootstrap-datatable ">
                        <thead>
                        <tr>
                            <!--<th>#</th>-->
<!--                            <th>url</th>-->
                            <th>用户名</th>
                            <th>手机号码</th>
                            <th>状态</th>
                            <th>押金</th>
                            <th>加入时间</th>
                        </tr>
                        </thead>
                        <tbody id="content-list">
                        <tr v-for="item in tableItems">
                            <!-- <td>{{item.info.id}}</td>-->
<!--                            <td width="10%"><a :href="item.info.url">{{item.info.url}}</a></td>-->
                            <td>{{item.info.name}}</a></td>
                            <td>{{item.info.phone}}</td>
                            <td>{{item.info.status}}</td>
<!--                            <td>{{item.info.is_paidRent}}</td>-->
                            <td v-if="item.info.is_paidRent=='1'" ><span class="label label-success">已付押金</span></td>
                            <td v-if="item.info.is_paidRent=='0'"><span class="label label-important">未付押金</span></td>
                            <td>{{item.info.create_time}}</td>
<!--                            <td class="user-info-config text-danger">-->
<!--                                <a class="btn btn-info" @click="popUpdataUser(item)">-->
<!--                                   修改-->
<!--                                </a>-->
<!--                                <a class="btn btn-danger" @click="deleteUserAuthority(item)">-->
<!--                                   删除-->
<!--                                </a>-->
<!--                            </td>-->
                        </tr>
                        </tbody>
                    </table>
                </div>
                <!--       stat：         页码-->
                <div style="text-align: center">

                    <div v-if="totalPage==0">
                        <div class="alert alert-block">
                            <button type="button" class="close" data-dismiss="alert">×</button>
                            <strong>暂无数据</strong>
                        </div>
                    </div>
                    <ul class="pagination pagination-lg" v-else>
                        <template v-if="nowPage==1">
                            <li class="disabled"><a>&laquo;</a></li>
                        </template>
                        <template v-else>
                            <li @click="getList(nowPage-1)"><a>&laquo;</a></li>
                        </template>
                        <template v-if="1<nowPage-3">
                            <li class="disabled"><a>...</a></li>
                        </template>
                        <li v-for="item in paginationItems" :class="{active:nowPage==item.page}">
                            <template v-if="nowPage-4<=item.page && item.page<=nowPage+4">
                                <a @click="getList(item.page)">{{item.page}}</a>
                            </template>
                        </li>
                        <template v-if="totalPage>nowPage+3">
                            <li class="disabled"><a>...</a></li>
                        </template>
                        <template v-if="nowPage==totalPage">
                            <li class="disabled"><a>&raquo;</a></li>
                        </template>
                        <template v-else>
                            <li @click="getList(nowPage+1)"><a>&raquo;</a></li>
                        </template>

                    </ul>
                </div><!--             end：   页码-->

                <!-- end: 列表 -->
            </div><!--/.fluid-container-->

            <!--添加单用户弹窗-->
            <div class="modal fade hide" id="pop-add-user" role="dialog" aria-hidden="true" data-backdrop="false">
                <div class="modal-dialog modal-md">
                    <div class="modal-content">
                        <div class="modal-header">
                            提示
                        </div>
                        <div class="modal-body">
                            <form role="form" class="form-horizontal">
                                <div class="control-group">
                                    <label for="pop-set-up-url" class="control-label">url(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-add-user-url"
                                               autocomplete="off" placeholder="请输入url"/ >
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-url_name" class="control-label">url名称(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-add-user-url_name"
                                               autocomplete="off" placeholder="请输入url名称"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-login_id" class="control-label">账号</label>
                                    <div class="controls">
                                        <input type="tel" maxlength="18" class="form-control" id="pop-add-user-login_id"
                                               autocomplete="off" placeholder="请输入账号"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-passwd" class="control-label">密码</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-add-user-passwd"
                                               autocomplete="off" placeholder="请输入密码"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-create_name" class="control-label">创建人(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-add-user-create_name"
                                               autocomplete="off" placeholder="请输入创建人"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-add-user-bz" class="control-label">备注</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-add-user-bz"
                                               autocomplete="off" placeholder="请输入备注"/>
                                    </div>
                                </div>


                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-primary" id="pop-add-simple-user-submit"
                                    @click="popAddUserSubmit()">确定
                            </button>
                            <button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </div>
            </div>


            <!--修改单用户弹窗-->
            <div class="modal fade hide" id="pop-updata-user" role="dialog" aria-hidden="true" data-backdrop="false">
                <div class="modal-dialog modal-md">
                    <div class="modal-content">
                        <div class="modal-header">
                            提示
                        </div>
                        <div class="modal-body">
                            <form role="form" class="form-horizontal">
                                <div class="control-group">
                                    <label for="pop-set-up-name" class="control-label">姓名(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-name"
                                               autocomplete="off" placeholder="请输入姓名"/ >
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="selectError1" class="control-label">性别(必选)</label>
                                    <div class="controls">
                                        <select id="selectError4">
                                            <option value="男">男</option>
                                            <option value="女">女</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-phone" class="control-label">手机号码</label>
                                    <div class="controls">
                                        <input type="tel" maxlength="11" class="form-control" id="pop-updata-user-phone"
                                               autocomplete="off" placeholder="请输入手机号"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-brith" class="control-label">出生日期(必填)</label>
                                    <div class="controls">
                                        <input type="date" class="form-control" id="pop-updata-user-brith"
                                               autocomplete="off" placeholder="请选择出生日期"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-where" class="control-label">籍贯(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-where"
                                               autocomplete="off" placeholder="请选择籍贯"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-id" class="control-label">身份证</label>
                                    <div class="controls">
                                        <input type="tel" maxlength="18" class="form-control" id="pop-updata-user-id"
                                               autocomplete="off" placeholder="请输入身份证号"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-class" class="control-label">部门(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-class"
                                               autocomplete="off" placeholder="请输入部门名称"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-department" class="control-label">科室(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-department"
                                               autocomplete="off" placeholder="请输入科室名称"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-status" class="control-label">职级(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-status"
                                               autocomplete="off" placeholder="请输入职级名称"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="selectError2" class="control-label">是否倒班(必选)</label>
                                    <div class="controls">
                                        <select id="selectError5">
                                            <option value="是">是</option>
                                            <option value="否">否</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="selectError3" class="control-label">是否双职工(必选)</label>
                                    <div class="controls">
                                        <select id="selectError6">
                                            <option value="是">是</option>
                                            <option value="否">否</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label for="pop-set-up-marry" class="control-label">婚姻状况(必填)</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-marry"
                                               autocomplete="off" placeholder="请输入婚姻状况"/>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label for="pop-set-up-spouse" class="control-label">配偶姓名</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-spouse"
                                               autocomplete="off" placeholder="请输入配偶姓名"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-car" class="control-label">车牌号</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-car"
                                               autocomplete="off" placeholder="请输入车牌号"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="pop-set-up-bz" class="control-label">备注</label>
                                    <div class="controls">
                                        <input type="text" class="form-control" id="pop-updata-user-bz"
                                               autocomplete="off" placeholder="请输入备注"/>
                                    </div>
                                </div>


                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-primary" id="pop-updata-simple-user-submit"
                                    @click="popupdataUserSubmit()">确定
                            </button>
                            <button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </div>
            </div><!--end:修改用户-->

            <!--用户名导出excel弹窗-->
            <div class="modal fade hide" id="pop-download" role="dialog" aria-hidden="true" data-backdrop="false">
                <div class="modal-dialog modal-sm">
                    <div class="modal-content">
                        <div class="modal-header">
                            提示
                        </div>
                        <div class="modal-body">

                            是否准备导出人员信息？
                            <br/>
                            <!--                    <input name="token"  value=token>-->
                            <!--                    <input name="time"  value=unixtime>-->
                            <input name="token" type="hidden" :value="token">
                            <input name="time" type="hidden" :value="unixtime">
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary" id="pop-download-submit"
                                    @click="downloadUserInfo">确定
                            </button>
                            <button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
                        </div>


                    </div>
                </div>
            </div>
            <!-- 退款弹窗-->
            <div class="modal fade hide" id="pop-refund" role="dialog" aria-hidden="true" data-backdrop="false">
                <div class="modal-dialog modal-sm">
                    <div class="modal-content">
                        <div class="modal-header">
确认退款？
                        </div>
                         <div class="modal-body">
                             <form role="form" class="form-horizontal">
                             <div class="control-group">
                                 <label for="pop-set-up-car" class="control-label">请输入登陆密码</label>
                                 <div class="controls">
                                     <input type="password" class="form-control" id="pop-refund-passwd"/>
                                 </div>
                             </div>

                                <input name="token" type="hidden" :value="token">
                                <input name="time" type="hidden" :value="unixtime">
                             </form>
                            </div>
                            <div class="modal-footer">
                                <button type="submit" class="btn btn-primary" id="pop-refund-submit" @click="refund_order()">确定
                                </button>
                                <button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
                            </div>


                    </div>
                </div>
            </div>
            <!-- 用户名单导入excel弹窗-->
            <div class="modal fade hide" id="pop-upload" role="dialog" aria-hidden="true" data-backdrop="false">
                <div class="modal-dialog modal-sm">
                    <div class="modal-content">
                        <div class="modal-header">
                            提示
                        </div>
                        <form target="uploadIframe" action="api/person/excelAddUserInfo.php" style="margin: 0;"
                              enctype="multipart/form-data" method="post">
                            <div class="modal-body">

                                <div style="display: -webkit-flex;display: flex;justify-content: space-between"><span>选择xlsx文件：</span>
                                    <a href="<?php $r = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                                    $a_url = dirname($r);
                                    echo $a_url ?>/excelTemplate/user_info_template.xlsx"
                                       style="color:#0060ff;cursor:pointer">(模板下载)</a></div>
                                <br/>
                                <input type="file" name="file" id="inputfile"
                                       accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">

                                <input name="token" type="hidden" :value="token">
                                <input name="time" type="hidden" :value="unixtime">
                            </div>
                            <div class="modal-footer">
                                <button type="submit" class="btn btn-primary" id="pop-upload-submit">确定
                                </button>
                                <button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
                            </div>
                        </form>

                    </div>
                </div>
            </div>


        </div><!-- end: warp -->
        <!-- end: Content -->
    </div><!--/#content.span10-->
</div><!--/fluid-row-->


<iframe style="display: none;" name="uploadIframe">

</iframe>
<!-- start: JavaScript-->
<?php
//引入两个弹窗
include 'myTip_js.php';

?>

<script src="./js/vue.2.5.17.js"></script>
<!-- end: JavaScript-->
<script>
    <?php
    echo $token_info;
    ?>


    var theData = new Vue({
        el: "#wrap",
        data: {
            nowPage: 1,   //当前页码
            totalPage: 0,  //总页码
            paginationItems: [   //页面数组
                /*{page:{}}*/  //数据格式
            ],
            tableItems: [       //表格数组
                /*{info:{}}*/  //数据格式
            ],
            setUp_user: {},     //配置的用户
            search_btn_remark: "",    //存放用户搜索内容
            token: token,        //input file 的加密
            time: unixtime,       //input file 的加密
            search_status: "",         //存放用户搜索status内容
            // flooritem: [],
            // roomitem: [],

            // search_room: "",            //存放用户搜索roon_name内容
            // refund_id:0
        },
        methods: {
            getList: function (nextPage) {   //获取每个分页的数据
                var that = this;
                var search = "";
                var search_status = "";

                if (that.search_btn_remark != "") {
                    search = that.search_btn_remark;
                }
                if (that.search_status != "") {
                    search_status = that.search_status;
                }
                $.ajax({
                    url: 'api/user_list/get_user_list.php',
                    type: 'POST',
                    data: {
                        token: token,
                        time: unixtime,
                        nextPage: nextPage,
                        search: search,
                        search_status: search_status
                    },
                    dataType: 'JSON',
                    beforeSend: function () {
                        $("#loading-mask").show();
                    },
                    error: function () {
                        $("#loading-mask").hide();
                        MyAlert("请求超时");
                    },
                    success: function (res) {
                        console.log(res);
                        $("#loading-mask").hide();
                        if (res.err == 0) {
                            that.tableItems = res.msg;
                            that.nowPage = nextPage;
                        } else {
                            MyAlert(res.msg);
                        }
                    }
                })
            },
            getPagination: function () {    //获取分页数量
                var that = this;
                var search = "";
                var search_status = "";
                if (that.search_btn_remark != "") {
                    search = that.search_btn_remark;
                }
                if (that.search_status != "") {
                    search_status = that.search_status;
                }
                $.ajax({
                    url: 'api/user_list/page_info.php',
                    type: 'POST',
                    data: {
                        token: token,
                        time: unixtime,
                        search: search,
                        search_status: search_status
                    },
                    dataType: 'JSON',
                    beforeSend: function () {
                        $("#loading-mask").show();
                    },
                    error: function () {
                        $("#loading-mask").hide();
                        MyAlert("分页请求超时");
                    },
                    success: function (res) {
                        $("#loading-mask").hide();
                        if (res.err == 0) {
                            console.log(res.msg);
                            that.paginationItems = res.msg;
                            that.totalPage = res.total_page;
                        } else {
                            MyAlert(res.msg);
                        }
                    }
                })
            },
            select_status: function () {
                if ($("#user_status").val() == "全部") {
                    this.search_status = "";
                } else {
                    this.search_status = $("#user_status").val();
                }
                this.getPagination();
                this.getList(1);
            },
            // select_floor: function () {
            //     $("#roomName").val("全部");
            //     this.search_room = "";
            //     if ($("#floor").val() == "全部") {
            //         this.search_floor = "";
            //     } else {
            //         this.search_floor = $("#floor").val();
            //     }
            //     this.getPagination();
            //     this.getList(1);
            // },
            // select_room: function () {
            //     if ($("#floor").val() == "全部") {
            //         this.search_room = "";
            //     } else if ($("#roomName").val() == "全部") {
            //         this.search_room = "";
            //     } else {
            //         this.search_room = $("#roomName").val();
            //     }
            //     this.getPagination();
            //     this.getList(1);
            // },
            // refund_order:function(){
            //     var that=this;
            //     var passwd=$("#pop-refund-passwd").val();
            //     if(passwd!=''){
            //         $.ajax({
            //             url: "api/pay_list/refund.php",
            //             type: 'POST',
            //             data: {
            //                 token: token,
            //                 time: unixtime,
            //                 index: that.refund_id,
            //                 passwd:passwd
            //             },
            //             dataType: 'JSON',
            //             beforeSend: function () {
            //                 $("#loading-mask").show();
            //             },
            //             error: function () {
            //                 $("#loading-mask").hide();
            //                 alert("请求超时");
            //             },
            //             success: function (res) {
            //                 $("#loading-mask").hide();
            //                 if (res.err == 0) {
            //                     MyAlert(res.msg, function () {
            //                         console.log(123);
            //                         window.location.reload();
            //                     });
            //                 } else {
            //                     MyAlert(res.msg);
            //                 }
            //             }
            //         })
            //     }else{
            //         MyAlert("请输入密码");
            //     }
            //
            // },
            deleteUserAuthority: function (index) {   //退款
                MyAlert("暂未开发");
                return;
                this.refund_id=index;
                $("#pop-refund").modal();
            },


            popupdataUserSubmit: function () {//修改用户信息
                MyAlert("暂未开发");
                return;
                var namm = $("#pop-updata-user-name").val();
                var phon = $("#pop-updata-user-phone").val();
                var clas = $("#pop-updata-user-class").val();
                var depa = $("#pop-updata-user-department").val();
                var stat = $("#pop-updata-user-status").val();
                var wher = $("#pop-updata-user-where").val();
                var brit = $("#pop-updata-user-brith").val();
                var marr = $("#pop-updata-user-marry").val();
                var idca = $("#pop-updata-user-id").val();
                var spou = $("#pop-updata-user-spouse").val();
                var carn = $("#pop-updata-user-car").val();
                var bzzz = $("#pop-updata-user-bz").val();
                var sexx = $('#selectError4 option:selected').val();
                var daob = $('#selectError5 option:selected').val();
                var peop = $('#selectError6 option:selected').val();
                var regIdnum = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
                var regPhone = /^1(3|4|5|6|7|8)\d{9}$/;
                if (name == namm && phone == phon && className == clas && department == depa && status == stat && where == wher &&
                    brith == brit && marry == marr && id_car == idca && spouse == spou && car == carn && bz == bzzz &&
                    sex == sexx && daoban == daob && both == peop) {
                    MyAlert("信息未修改！");
                }
                else if (namm == "" || clas == "" || depa == "" || stat == "" || wher == "" || brit == "" || marr == "" || sexx == "" || daob == "" || peop == "") {
                    MyAlert("信息请填写完整！");
                } else if (idca != "" && !regIdnum.test(idca)) {
                    MyAlert("请输入正确的身份证号码！");
                } else if (!regPhone.test(phon)) {
                    MyAlert("请输入正确的手机号码！");
                }
                else {
                    MyConfirm("确定修改?", function () {
                        $.ajax({
                            url: "api/person/updataUserAuthority.php",
                            type: 'POST',
                            data: {
                                token: token,
                                time: unixtime,
                                name: namm,
                                phone: phon,
                                classname: clas,
                                id: id,
                                department: depa,
                                status: stat,
                                from_where: wher,
                                brith: brit,
                                marry: marr,
                                id_car: idca,
                                spouse: spou,
                                car: carn,
                                bz: bzzz,
                                sex: sexx,
                                daoban: daob,
                                both: peop,
                            },
                            dataType: 'JSON',
                            beforeSend: function () {
                                $("#loading-mask").show();
                            },
                            error: function () {
                                $("#loading-mask").hide();
                                alert("请求超时");
                            },
                            success: function (res) {
                                $("#loading-mask").hide();
                                if (res.err == 0) {
                                    MyAlert(res.msg, function () {
                                        console.log(123);
                                        window.location.reload();
                                    });
                                } else {
                                    MyAlert(res.msg);
                                }
                            }
                        })
                    })
                }
            },
            search: function () {      //查询
                var regSpace = /^\s+$/;
                if ($("#search-text").val() && !regSpace.test($("#search-text").val())) {
                    this.search_btn_remark = $("#search-text").val();
                    this.getPagination();
                    this.getList(1);
                } else {
                    MyAlert("请输入搜索内容");
                }
            },
            popUpdataUser: function (item) {  //修改人员信息弹窗
                MyAlert("暂未开发");
                return;
                $("#pop-updata-user").modal();
                $("#pop-updata-user-name").val(item.info.name);
                $("#pop-updata-user-phone").val(item.info.phone);
                $("#pop-updata-user-class").val(item.info.className);
                $("#pop-updata-user-department").val(item.info.department);
                $("#pop-updata-user-status").val(item.info.status);
                $("#pop-updata-user-where").val(item.info.from_where);
                $("#pop-updata-user-brith").val(item.info.birth_day);
                $("#pop-updata-user-marry").val(item.info.marry);
                $("#pop-updata-user-building").val(item.info.buildingnum);
                $("#pop-updata-user-room").val(item.info.roomnum);
                $("#pop-updata-user-id").val(item.info.id_card);
                $("#pop-updata-user-spouse").val(item.info.spouse);
                $("#pop-updata-user-car").val(item.info.carnum);
                $("#pop-updata-user-bz").val(item.info.bz);
                $('#selectError4').val(item.info.sex);
                $('#selectError5').val(item.info.daoban);
                $('#selectError6').val(item.info.both_people);
                name = item.info.name;//修改信息前姓名
                phone = item.info.phone;//修改信息前电话
                className = item.info.className; //修改信息前部门
                id = item.info.id; //修改信息前id
                department = item.info.department;
                status = item.info.status;
                where = item.info.from_where;
                brith = item.info.birth_day;
                marry = item.info.marry;
                building = item.info.buildingnum;
                room = item.info.roomnum;
                id_car = item.info.id_card;
                spouse = item.info.spouse;
                car = item.info.carnum;
                bz = item.info.bz;
                sex = item.info.sex;
                daoban = item.info.daoban;
                both = item.info.both_people;
            },
            popUploadUser: function () {    //人员excel模板弹窗
                $("#pop-upload").modal();
            },
            popAddUser: function () {      //添加单人员弹窗
                $("#pop-add-user").modal();
            },
            popDownloadUser: function () {
                // $("#loading-mask").show();
                $("#pop-download").modal();
            },

            //人员添加时入住  楼号 房号 不为空
            // join_room: function (floor_name, room_name) {
            //     $.ajax({
            //         url: 'api/person/check_room.php',
            //         type: 'POST',
            //         data: {
            //             token: token,
            //             time: unixtime,
            //             floor_name: floor_name,
            //             room_name: room_name,
            //         },
            //         dataType: 'JSON',
            //         beforeSend: function () {
            //             $("#loading-mask").show();
            //         },
            //         error: function () {
            //             $("#loading-mask").hide();
            //         },
            //         success: function (res) {
            //             console.log("keyi");
            //         }
            //     })
            // },

            // popAddUserSubmit: function () {//添加单人人员信息
            //
            //     var url = $("#pop-add-user-url").val();
            //     var url_name = $("#pop-add-user-url_name").val();
            //     var login_id = $("#pop-add-user-login_id").val();
            //     var passwd = $("#pop-add-user-passwd").val();
            //
            //     var create_name = $("#pop-add-user-create_name").val();
            //
            //     var bz = $("#pop-add-user-bz").val();
            //
            //
            //     if (url != "" && name != "" && url_name != "" ) {
            //         if (!IsURL(url) || url == "") {
            //             MyAlert("请填写正确的url");
            //         }
            //         else {
            //             // if(building!=""&& room!=""){
            //             //     console.log(building,room);
            //             //  this.$options.methods.join_room(building,room);
            //             // }
            //             $.ajax({
            //                 url: 'api/person/add_user.php',
            //                 type: 'POST',
            //                 data: {
            //                     token: token,
            //                     time: unixtime,
            //                     url: url,
            //                     url_name: url_name,
            //                     login_id: login_id,
            //                     passwd: passwd,
            //                     create_name: create_name,
            //                     remark: bz
            //                 },
            //                 dataType: 'JSON',
            //                 beforeSend: function () {
            //                     $("#loading-mask").show();
            //                 },
            //                 error: function () {
            //                     $("#loading-mask").hide();
            //                 },
            //                 success: function (res) {
            //                     $("#loading-mask").hide();
            //                     console.log(res);
            //                     if (res.err == 0) {
            //                         MyAlert(res.msg, function () {
            //                             console.log(123);
            //                             window.location.reload();
            //                         });
            //
            //                     } else {
            //                         MyAlert(res.msg);
            //                     }
            //                 }
            //             })
            //         }
            //     }
            //     else {
            //         MyAlert("请填写必填信息");
            //     }
            // },
            // getfloor: function () {//获取楼宇信息
            //     var that = this;
            //     $.ajax({
            //         url: 'api/room/get_floor.php',
            //         type: 'POST',
            //         data: {
            //             token: token,
            //             time: unixtime,
            //         },
            //         dataType: 'JSON',
            //         beforeSend: function () {
            //             $("#loading-mask").show();
            //         },
            //         error: function () {
            //             $("#loading-mask").hide();
            //             MyAlert("分页请求超时");
            //         },
            //         success: function (res) {
            //             $("#loading-mask").hide();
            //             if (res.err == 0) {
            //                 that.flooritem = res.msg;
            //                 console.log(that.flooritem);
            //             } else {
            //                 MyAlert(res.msg);
            //             }
            //         }
            //     })
            // },

            popExcelAddUserAuthority: function () {       //Excel添加补助金弹窗
                $("#pop-excel-add-user-authority").modal();
            },
            popExcelAddGrantsSubmit: function () {

            },
            downloadUserInfo: function () {
                $.ajax({
                    url: "api/person/excelDownloadUserInfo.php",
                    type: 'POST',
                    data: {
                        token: token,
                        time: unixtime
                    },
                    dataType: 'JSON',
                    beforeSend: function () {
                        $("#loading-mask").show();
                    },
                    error: function () {
                        $("#loading-mask").hide();
                        MyAlert("请求超时");
                    },
                    success: function (res) {
                        $("#pop-download").modal('hide');
                        console.log(res);
                        $("#loading-mask").hide();
                        if (res.status == 1) {
                            window.location.href = res.info;
                        } else {
                            MyAlert(res.info);
                        }
                    }
                })
            }
        }
    });

    //theData.getfloor();//首次加载获取楼宇信息
    theData.getPagination();   //首次加载总页码
    theData.getList(theData.nowPage);  //首次加载首个分页
    function IsURL (str_url) {
        var strRegex = '^((https|http|ftp|rtsp|mms)?://)'
            + '?(([0-9a-z_!~*\'().&=+$%-]+: )?[0-9a-z_!~*\'().&=+$%-]+@)?' //ftp的user@
            + '(([0-9]{1,3}.){3}[0-9]{1,3}' // IP形式的URL- 199.194.52.184
            + '|' // 允许IP和DOMAIN（域名）
            + '([0-9a-z_!~*\'()-]+.)*' // 域名- www.
            + '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].' // 二级域名
            + '[a-z]{2,6})' // first level domain- .com or .museum
            + '(:[0-9]{1,4})?' // 端口- :80
            + '((/?)|' // a slash isn't required if there is no file name
            + '(/[0-9a-z_!~*\'().;?:@&=+$,%#-]+)+/?)$';
        var re=new RegExp(strRegex);
        if (re.test(str_url)) {
            return true;
        } else {
            return false;
        }
    }
</script>


</body>
</html>
